package main

import (
	api "ZHONGYIHANGYAN/api/apiWeb"
	evaluateResult "ZHONGYIHANGYAN/business/evaluateResult"
	evaluateTotalResult "ZHONGYIHANGYAN/business/evaluateTotalResult"
	evaluateSegmentTime "ZHONGYIHANGYAN/business/evaluateSegmentTime"
	evaluateTask "ZHONGYIHANGYAN/business/evaluateTask"
	expertAndEvaluateTaskRelationship "ZHONGYIHANGYAN/business/expertAndEvaluateTaskRelationship"
	liveresource "ZHONGYIHANGYAN/business/liveResource"
	quota "ZHONGYIHANGYAN/business/quota"
	template "ZHONGYIHANGYAN/business/template"
	terminalResource "ZHONGYIHANGYAN/business/terminalResource"
	user "ZHONGYIHANGYAN/business/user"
	role "ZHONGYIHANGYAN/business/role"
	vodResource "ZHONGYIHANGYAN/business/vodResource"
	"ZHONGYIHANGYAN/cfg"
	mysql "ZHONGYIHANGYAN/mysql"
	web "ZHONGYIHANGYAN/web"
	"fmt"
)

func main() {
	// 初始化配置
	cfg.Load()

	// 连接Mysql数据库
	db := mysql.New()
	db.ConnectMysql(cfg.Sys.Mysql.Url)
	// 初始化数据库表
	template.InitTable(db)
	user.InitTable(db)
	role.InitTable(db)
	quota.InitTable(db)
	evaluateTask.InitTable(db)
	expertAndEvaluateTaskRelationship.InitTable(db)
	evaluateSegmentTime.InitTable(db)
	evaluateResult.InitTable(db)
	evaluateTotalResult.InitTable(db)
	liveresource.InitTable(db)
	vodResource.InitTable(db)
	terminalResource.InitTable(db)
	w := web.New()
	api.New(w)
	w.Start(fmt.Sprintf("0.0.0.0:%d", cfg.Sys.WebPort))

}
